package com.xm2.demo.system.echart.controller;

import com.xm2.demo.system.echart.service.EchartService;
import com.xm2.demo.system.echart.vo.Count;
import com.xm2.demo.system.echart.vo.Data;
import com.xm2.demo.utils.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

/**
 * @Create
 * @create 2018-12-12 16:29
 * @Description：
 */
@Controller
@RequestMapping(value = "/system/")
public class EchartController {

    @Autowired
    private EchartService echartService;

    @GetMapping(value = "echart1")
    public String echart1(){
        return "echart1";
    }

    @PostMapping(value = "showEcharBar1",consumes = "application/json")
    @ResponseBody
    public JsonResult result(@RequestBody Data data){
        List<Count>  counts = echartService.echart(data);
        return new JsonResult(counts);
    }
}
